{extend name="public:base"/}
{block name="style"}

{/block}
{block name="main"}

<!-- <link rel="stylesheet" type="text/css" href="__Com__/fileupload/css/jquery.fileupload.css"> -->

<form class="layui-form" action="" method="POST" >
 
  <div class="layui-form-item">
    <label class="layui-form-label">站点名称</label>
    <div class="layui-input-block  width-350">
    <input type="hidden" name="siteid" value="{$info['siteid']}">
      <input type="text" name="name" required  lay-verify="required" placeholder="请输入站点名称" autocomplete="off" class="layui-input" value="{$info['name']}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">站点域名</label>
    <div class="layui-input-block  width-350">
      <input type="text" name="link"  placeholder="请输入站点域名" autocomplete="off" class="layui-input" value="{$info['link']}">
    </div>
  </div>
  <div class="layui-form-item">
      <label class="layui-form-label">站点logo</label>
      <div class="layui-input-inline" style="width:350px;">
        <input type="text" name="logo" required lay-verify="required" placeholder="图片地址" autocomplete="off" class="layui-input"  value="{$info['logo']}">
      </div>
      <div class="layui-form-mid layui-word-aux" style="padding:0px !important">
        <button type="button" class="layui-btn layui-btn-small fileupload" lay-data="{data:{type:'image'},accept:'images'}" data-name="thumb">
          <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
        
          <img src="{$info['logo']}" style="max-width: 38px !important;margin-left:10px; {if condition="$info['logo'] neq ''"}display:none;{/if}" id="logo">
        
        
      </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">站点关键字</label>
    <div class="layui-input-block  width-350">
      <textarea name="keyword" required lay-verify="required" placeholder="请输入站点关键字" class="layui-textarea">{$info['keyword']}</textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">站点描述</label>
    <div class="layui-input-block  width-350">
      <textarea name="description" required lay-verify="required" placeholder="请输入站点描述" class="layui-textarea">{$info['description']}</textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">统计代码</label>
    <div class="layui-input-block  width-350">
      <textarea name="code" required lay-verify="required" placeholder="请输入统计代码" class="layui-textarea">{$info['code']}</textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">备案编号</label>
    <div class="layui-input-block  width-350">
      <input type="text" name="beian"  placeholder="请输入备案编号" autocomplete="off" class="layui-input" value="{$info['beian']}">
    </div>
  </div>
 <div class="layui-form-item">
      <label class="layui-form-label">手机端</label>
      <div class="layui-input-block width-350">
        <input type="checkbox" name="mobile" lay-skin="switch" lay-text="启用|关闭" lay-filter="switchTest" value="1" {if condition="$info['mobile'] eq '1'"}checked=''{/if}>
        <div class="layui-unselect layui-form-switch" lay-skin="_switch">
          <em>OFF</em><i></i>
        </div>
      </div>
    </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
    </div>
  </div>
</form>


<script type="text/javascript">
	layui.use(['form','upload'], function(){
	  var form = layui.form;
    var upload=layui.upload

    //上传
    var uploadInst = upload.render({
        elem: '.fileupload' //绑定元素
        ,url: '{:Url('common/fileupload')}' //上传接口
        ,done: function(res){
           if(res.status=='1'){
             layui.$("input[name='logo']").val(res.path);
             layui.$("#logo").attr("src",res.path);
             $("#logo").show();
             alert("上传成功~");
           }else{
            alert("上传失败~");
           }
        }
        ,error: function(){
          alert("上传失败~");
        },accept: 'images'
        ,field:'file'
        ,data:{type:'image'}
    });

    layer.photos({
      photos: 'div'
      ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });

	  form.verify({
	    title: function(value){
	      if(value.length < 1){
	        return '标题至少得1个字符';
	      }
	    }
	  });
    
	});
</script>

{/block}